﻿@{
  ViewBag.Title = "Ajax";
}

<h2>Ajax</h2>
<ol id="list"></ol>
<button class="btnGo">test</button>
<button class="btnGo">test</button>
@section scripts
{
  <script>
    $(function () {
      $('.btnGo').click(function () {
        for (var i = 0; i < 10; i++) {
          (function (id) {
            $.post('@Url.Action("Ajax")', { id: id }, function (data) {
              $('#list').append('<li>' + data + '</li>');
            }
            );
          }
          )(i);
        }
      });
    });
  </script>
}
